Optimal. Leaf size=494 \[ \frac {x \left (A c \left (b^2-2 a c\right )-a (b B c-2 a c C+a b D)+\left (b c (A c+a C)-a b^2 D-2 a c (B c-a D)\right ) x^n\right )}{a c \left (b^2-4 a c\right ) n \left (a+b x^n+c x^{2 n}\right )}+\frac {\left (a b^2 D-b c (A c+a C) (1-n)+2 a c (B c (1-n)-a D (1+n))+\frac {A c^2 \left (4 a c (1-2 n)-b^2 (1-n)\right )-a \left (4 a c^2 C+b^3 D-b^2 c C (1-n)-2 b c (B c n+a D (2+n))\right )}{\sqrt {b^2-4 a c}}\right ) x \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {2 c x^n}{b-\sqrt {b^2-4 a c}}\right )}{a c \left (b^2-4 a c\right ) \left (b-\sqrt {b^2-4 a c}\right ) n}+\frac {\left (a b^2 D-b c (A c+a C) (1-n)+2 a c (B c (1-n)-a D (1+n))-\frac {A c^2 \left (4 a c (1-2 n)-b^2 (1-n)\right )-a \left (4 a c^2 C+b^3 D-b^2 c C (1-n)-2 b c (B c n+a D (2+n))\right )}{\sqrt {b^2-4 a c}}\right ) x \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {2 c x^n}{b+\sqrt {b^2-4 a c}}\right )}{a c \left (b^2-4 a c\right ) \left (b+\sqrt {b^2-4 a c}\right ) n} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 1.05, antiderivative size = 494, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.079, Rules used = {1808, 1436,
251} \begin {gather*} \frac {x \left (x^n \left (b c (a C+A c)-a b^2 D-2 a c (B c-a D)\right )+A c \left (b^2-2 a c\right )-a (a b D-2 a c C+b B c)\right )}{a c n \left (b^2-4 a c\right ) \left (a+b x^n+c x^{2 n}\right )}+\frac {x \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {2 c x^n}{b-\sqrt {b^2-4 a c}}\right ) \left (\frac {A c^2 \left (4 a c (1-2 n)-b^2 (1-n)\right )-a \left (-2 b c (a D (n+2)+B c n)+4 a c^2 C+b^3 D-b^2 c C (1-n)\right )}{\sqrt {b^2-4 a c}}-b c (1-n) (a C+A c)+a b^2 D+2 a c (B c (1-n)-a D (n+1))\right )}{a c n \left (b^2-4 a c\right ) \left (b-\sqrt {b^2-4 a c}\right )}+\frac {x \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {2 c x^n}{b+\sqrt {b^2-4 a c}}\right ) \left (-\frac {A c^2 \left (4 a c (1-2 n)-b^2 (1-n)\right )-a \left (-2 b c (a D (n+2)+B c n)+4 a c^2 C+b^3 D-b^2 c C (1-n)\right )}{\sqrt {b^2-4 a c}}-b c (1-n) (a C+A c)+a b^2 D+2 a c (B c (1-n)-a D (n+1))\right )}{a c n \left (b^2-4 a c\right ) \left (\sqrt {b^2-4 a c}+b\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 251
Rule 1436
Rule 1808
Rubi steps
\begin {align*} \int \frac {A+B x^n+C x^{2 n}+D x^{3 n}}{\left (a+b x^n+c x^{2 n}\right )^2} \, dx &=\frac {x \left (A c \left (b^2-2 a c\right )-a (b B c-2 a c C+a b D)+\left (b c (A c+a C)-a b^2 D-2 a c (B c-a D)\right ) x^n\right )}{a c \left (b^2-4 a c\right ) n \left (a+b x^n+c x^{2 n}\right )}+\frac {\int \frac {a b (B c+a D)-2 a c (a C-A c (1-2 n))-A b^2 c (1-n)+\left (a b^2 D-b c (A c+a C) (1-n)+2 a c (B c (1-n)-a D (1+n))\right ) x^n}{a+b x^n+c x^{2 n}} \, dx}{a c \left (b^2-4 a c\right ) n}\\ &=\frac {x \left (A c \left (b^2-2 a c\right )-a (b B c-2 a c C+a b D)+\left (b c (A c+a C)-a b^2 D-2 a c (B c-a D)\right ) x^n\right )}{a c \left (b^2-4 a c\right ) n \left (a+b x^n+c x^{2 n}\right )}+\frac {\left (a b^2 D-b c (A c+a C) (1-n)+2 a c (B c (1-n)-a D (1+n))-\frac {A c^2 \left (4 a c (1-2 n)-b^2 (1-n)\right )-a \left (4 a c^2 C+b^3 D-b^2 c C (1-n)-2 b c (B c n+a D (2+n))\right )}{\sqrt {b^2-4 a c}}\right ) \int \frac {1}{\frac {b}{2}+\frac {1}{2} \sqrt {b^2-4 a c}+c x^n} \, dx}{2 a c \left (b^2-4 a c\right ) n}+\frac {\left (a b^2 D-b c (A c+a C) (1-n)+2 a c (B c (1-n)-a D (1+n))+\frac {A c^2 \left (4 a c (1-2 n)-b^2 (1-n)\right )-a \left (4 a c^2 C+b^3 D-b^2 c C (1-n)-2 b c (B c n+a D (2+n))\right )}{\sqrt {b^2-4 a c}}\right ) \int \frac {1}{\frac {b}{2}-\frac {1}{2} \sqrt {b^2-4 a c}+c x^n} \, dx}{2 a c \left (b^2-4 a c\right ) n}\\ &=\frac {x \left (A c \left (b^2-2 a c\right )-a (b B c-2 a c C+a b D)+\left (b c (A c+a C)-a b^2 D-2 a c (B c-a D)\right ) x^n\right )}{a c \left (b^2-4 a c\right ) n \left (a+b x^n+c x^{2 n}\right )}+\frac {\left (a b^2 D-b c (A c+a C) (1-n)+2 a c (B c (1-n)-a D (1+n))+\frac {A c^2 \left (4 a c (1-2 n)-b^2 (1-n)\right )-a \left (4 a c^2 C+b^3 D-b^2 c C (1-n)-2 b c (B c n+a D (2+n))\right )}{\sqrt {b^2-4 a c}}\right ) x \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {2 c x^n}{b-\sqrt {b^2-4 a c}}\right )}{a c \left (b^2-4 a c\right ) \left (b-\sqrt {b^2-4 a c}\right ) n}+\frac {\left (a b^2 D-b c (A c+a C) (1-n)+2 a c (B c (1-n)-a D (1+n))-\frac {A c^2 \left (4 a c (1-2 n)-b^2 (1-n)\right )-a \left (4 a c^2 C+b^3 D-b^2 c C (1-n)-2 b c (B c n+a D (2+n))\right )}{\sqrt {b^2-4 a c}}\right ) x \, _2F_1\left (1,\frac {1}{n};1+\frac {1}{n};-\frac {2 c x^n}{b+\sqrt {b^2-4 a c}}\right )}{a c \left (b^2-4 a c\right ) \left (b+\sqrt {b^2-4 a c}\right ) n}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(5439\) vs. \(2(494)=988\).
time = 8.22, size = 5439, normalized size = 11.01 \begin {gather*} \text {Result too large to show} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.02, size = 0, normalized size = 0.00 \[\int \frac {A +B \,x^{n}+C \,x^{2 n}+D x^{3 n}}{\left (a +b \,x^{n}+c \,x^{2 n}\right )^{2}}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int \frac {A+C\,x^{2\,n}+x^{3\,n}\,D+B\,x^n}{{\left (a+b\,x^n+c\,x^{2\,n}\right )}^2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________